<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JVM逃逸分析深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 卡片悬停效果 */
        .card-hover {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
        
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        
        /* 标题装饰线 */
        .title-decoration {
            position: relative;
            padding-bottom: 1rem;
        }
        
        .title-decoration::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
            border-radius: 2px;
        }
        
        /* 引用样式 */
        .quote-box {
            border-left: 4px solid #4f46e5;
            background: rgba(79, 70, 229, 0.05);
            padding: 1.5rem;
            margin: 2rem 0;
            border-radius: 0 8px 8px 0;
        }
        
        /* 代码块样式 */
        .code-block {
            background: #1e293b;
            color: #e2e8f0;
            padding: 1.5rem;
            border-radius: 8px;
            overflow-x: auto;
            font-family: 'Consolas', 'Monaco', monospace;
        }
        
        /* 数字指示器 */
        .number-indicator {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2rem;
            height: 2rem;
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
            border-radius: 50%;
            font-weight: 700;
            margin-right: 0.5rem;
        }
        
        /* 渐变文字 */
        .gradient-text {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 平滑滚动 */
        html {
            scroll-behavior: smooth;
        }
        
        /* Mermaid图表样式 */
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="relative overflow-hidden bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white">
        <div class="absolute inset-0 bg-black opacity-20"></div>
        <div class="relative container mx-auto px-6 py-24 text-center">
            <h1 class="text-5xl md:text-7xl font-bold mb-6 animate-pulse">
                JVM逃逸分析
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                深入理解Java虚拟机的性能优化核心技术
            </p>
            <div class="flex justify-center space-x-4">
                <span class="inline-flex items-center px-4 py-2 bg-white bg-opacity-20 rounded-full">
                    <i class="fas fa-rocket mr-2"></i>
                    性能优化
                </span>
                <span class="inline-flex items-center px-4 py-2 bg-white bg-opacity-20 rounded-full">
                    <i class="fas fa-memory mr-2"></i>
                    内存管理
                </span>
                <span class="inline-flex items-center px-4 py-2 bg-white bg-opacity-20 rounded-full">
                    <i class="fas fa-code mr-2"></i>
                    JVM技术
                </span>
            </div>
        </div>
        <div class="absolute bottom-0 left-0 right-0">
            <svg viewBox="0 0 1440 120" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M0 120L60 105C120 90 240 60 360 45C480 30 600 30 720 37.5C840 45 960 60 1080 67.5C1200 75 1320 75 1380 75L1440 75V120H1380C1320 120 1200 120 1080 120C960 120 840 120 720 120C600 120 480 120 360 120C240 120 120 120 60 120H0Z" fill="white"/>
            </svg>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        
        <!-- Introduction Section -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8 card-hover">
                <h2 class="text-3xl font-bold mb-6 title-decoration gradient-text">
                    <i class="fas fa-lightbulb mr-3"></i>什么是逃逸分析？
                </h2>
                <p class="text-lg leading-relaxed text-gray-700 drop-cap">
                    逃逸分析是一种静态分析技术，用于判断对象在程序中的"逃逸"范围，即对象是否可以在方法外部被访问。这个分析帮助我们了解对象是否需要在堆上分配，还是可以在方法的栈上进行分配。通过这种方式，逃逸分析能够在程序运行时减少不必要的内存分配和垃圾回收，从而提升应用的性能。
                </p>
                
                <div class="grid md:grid-cols-3 gap-6 mt-8">
                    <div class="bg-gradient-to-br from-blue-50 to-indigo-100 p-6 rounded-xl">
                        <i class="fas fa-layer-group text-3xl text-indigo-600 mb-4"></i>
                        <h3 class="font-bold text-xl mb-2">栈上分配</h3>
                        <p class="text-gray-700">将对象分配到栈上，减少垃圾回收开销</p>
                    </div>
                    <div class="bg-gradient-to-br from-purple-50 to-pink-100 p-6 rounded-xl">
                        <i class="fas fa-lock-open text-3xl text-purple-600 mb-4"></i>
                        <h3 class="font-bold text-xl mb-2">同步消除</h3>
                        <p class="text-gray-700">消除不必要的同步操作，提高并发性能</p>
                    </div>
                    <div class="bg-gradient-to-br from-green-50 to-emerald-100 p-6 rounded-xl">
                        <i class="fas fa-exchange-alt text-3xl text-green-600 mb-4"></i>
                        <h3 class="font-bold text-xl mb-2">标量替换</h3>
                        <p class="text-gray-700">将对象拆分为基本类型，提升访问效率</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Escape Analysis Types -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8 card-hover">
                <h2 class="text-3xl font-bold mb-6 title-decoration gradient-text">
                    <i class="fas fa-sitemap mr-3"></i>逃逸分析的类型
                </h2>
                
                <div class="space-y-6">
                    <div class="border-l-4 border-indigo-500 pl-6">
                        <h3 class="text-2xl font-bold mb-3 flex items-center">
                            <span class="number-indicator">1</span>
                            方法逃逸
                        </h3>
                        <p class="text-gray-700 leading-relaxed">
                            当一个对象的引用从创建它的方法内部逃逸到方法外部，即对象的生命周期超出了创建它的方法范围。编译器通过静态分析代码路径，判断对象是否会在方法调用结束后仍被引用。
                        </p>
                    </div>
                    
                    <div class="border-l-4 border-purple-500 pl-6">
                        <h3 class="text-2xl font-bold mb-3 flex items-center">
                            <span class="number-indicator">2</span>
                            线程逃逸
                        </h3>
                        <p class="text-gray-700 leading-relaxed">
                            当一个对象被多个线程访问时，我们称该对象发生了线程逃逸。对象的线程逃逸通常意味着需要在多线程环境中进行同步，以确保线程安全。
                        </p>
                    </div>
                    
                    <div class="border-l-4 border-pink-500 pl-6">
                        <h3 class="text-2xl font-bold mb-3 flex items-center">
                            <span class="number-indicator">3</span>
                            异常逃逸
                        </h3>
                        <p class="text-gray-700 leading-relaxed">
                            对象在异常处理流程中逃逸意味着即使发生了异常，该对象也可能被访问或修改。逃逸分析能够判断对象是否在异常情况下仍然会被使用。
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Visualization Section -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <h2 class="text-3xl font-bold mb-6 title-decoration gradient-text">
                    <i class="fas fa-project-diagram mr-3"></i>逃逸分析优化流程
                </h2>
                
                <div class="mermaid">
                    graph TD
                        A[对象创建] --> B{逃逸分析}
                        B -->|未逃逸| C[栈上分配]
                        B -->|方法逃逸| D[堆上分配]
                        B -->|线程逃逸| E[同步优化]
                        C --> F[自动释放]
                        D --> G[垃圾回收]
                        E --> H[锁消除/锁优化]
                        
                        style A fill:#f9f,stroke:#333,stroke-width:2px
                        style B fill:#bbf,stroke:#333,stroke-width:2px
                        style C fill:#bfb,stroke:#333,stroke-width:2px
                        style D fill:#fbb,stroke:#333,stroke-width:2px
                        style E fill:#fbf,stroke:#333,stroke-width:2px
                </div>
            </div>
        </section>

        <!-- Optimization Techniques -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <h2 class="text-3xl font-bold mb-6 title-decoration gradient-text">
                    <i class="fas fa-cogs mr-3"></i>JVM优化技术详解
                </h2>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div class="quote-box">
                        <h3 class="text-xl font-bold mb-3 text-indigo-700">
                            <i class="fas fa-database mr-2"></i>栈上分配
                        </h3>
                        <p class="text-gray-700">
                            将对象分配到方法的栈内存中，而不是传统的堆内存中。栈上的内存管理比堆更简单，方法执行结束后，栈上的对象会自动释放。
                        </p>
                        <ul class="mt-3 space-y-2 text-sm">
                            <li><i class="fas fa-check text-green-500 mr-2"></i>减少垃圾回收开销</li>
                            <li><i class="fas fa-check text-green-500 mr-2"></i>提高内存分配速度</li>
                            <li><i class="fas fa-check text-green-500 mr-2"></i>改善缓存局部性</li>
                        </ul>
                    </div>
                    
                    <div class="quote-box">
                        <h3 class="text-xl font-bol